using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.Tests.EnumHelper
{
    [TestClass]
    public class WhenParsing
    {
        [TestMethod]
        public void ShouldReturnParsedType()
        {
            string input = "Consumer";
            DomainType actual = Be.Timvw.Framework.EnumHelper.Parse<DomainType>(input);

            DomainType expected = DomainType.Consumer;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void ShouldThrowWhenInvalidInput()
        {
            string input = "Invalid";
            DomainType actual = Be.Timvw.Framework.EnumHelper.Parse<DomainType>(input);

            DomainType expected = DomainType.Consumer;

            Assert.AreEqual(expected, actual);
        }
    }
}